﻿Imports Mysoft.Map.Data
Imports System.Xml
Imports System.Data
Imports System.Text
Public Class CustomerNeed
    ' 功能：合同客户必填项
    ' 参数：oids			-- oid 字符串，多个 oid 之间用分号(;)分隔
    '       UserDataXml		-- 待扩展，暂时没有用
    ' 说明：函数必须包含这两个参数
    Public Shared Function SaveCustomerNeed(ByVal oids As String, ByVal UserDataXml As String) As String
        Try
            Dim SQL As String

            SQL = "UPDATE P_CustomerNeed SET IsNeeded=(CASE WHEN IsNeeded>0 THEN 0 ELSE 1 END)  WHERE ID IN  (" & oids & ")"

            If MyDB.ExecSQL(SQL) <> -1 Then       ' 如果执行成功
                Return "<xml result=""true""></xml>"
            Else        ' 如果执行失败
                Return "<xml result=""false"" errormessage=""保存失败！""></xml>"
            End If

        Catch ex As Exception
            Return "<xml result=""false"" errormessage=""运行时异常，请与管理员联系！""></xml>"

        End Try
    End Function
End Class